<?php

/*
 * 写入session
 */
if ( ! function_exists('set_session'))
{
	function set_session($name, $value)
	{
		$ci = & get_instance();
		$ci->session->set_userdata($name, $value);
	}
}

/*
 * 返回session值
 */
if ( ! function_exists('get_session'))
{
	function get_session($name)
	{
		$ci = & get_instance();
		return $ci->session->userdata($name);
	}
}

/*
 * 销毁session
 * name => 如值要销毁指定名称的session，此为名称
 */
if ( ! function_exists('destroy_session'))
{
	function destroy_session($name = NULL)
	{
		$ci = & get_instance();
		if (NULL !== $name)
		{
			$ci->session->unset_userdata($name);
		}
		else
		{
			$ci->session->sess_destroy();
		}
	}
}